
BOOST_INC_PATH = /home/lujun/boost/include
BOOST_LIB_FILE = /home/lujun/boost/lib/*.a 

COM_TOOLS_PATH = commontools/
COM_TOOLS_LIB = $(COM_TOOLS_PATH)libcommontools.a

#cc = clang++
cc = g++ -std=c++0x -O2

export BOOST_INC_PATH BOOST_LIB_FILE cc

all: main test 

main: main.o $(COM_TOOLS_LIB)
	$(cc) -o main  main.o  $(COM_TOOLS_LIB) $(BOOST_LIB_FILE) -lpthread

test: test.o $(COM_TOOLS_LIB)
	$(cc) -o test test.o $(COM_TOOLS_LIB) $(BOOST_LIB_FILE) -lpthread 

test.o: test.cpp  
	$(cc) -c test.cpp -I$(BOOST_INC_PATH) 

main.o: main.cpp 
	$(cc) -c main.cpp -I$(BOOST_INC_PATH)

$(COM_TOOLS_LIB):
	cd $(COM_TOOLS_PATH) && make 

.PHONY: clean
clean:
	-rm main test *.o
	cd $(COM_TOOLS_PATH) && make clean


